package com.serkol.ams.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.serkol.ams.bean.LoginConfig;
import com.serkol.ams.bean.MyPage;
import com.serkol.ams.entity.Users;
import com.serkol.exception.AuthException;

import java.util.List;
import java.util.Map;

/**
* @author pingan
* @description 针对表【users】的数据库操作Service
* @createDate 2022-09-16 19:40:18
*/
public interface UsersService extends IService<Users> {

    Users findByLogin(String openid);


    Users findByLoginAndInsert(Users usersDetail);


    Users findByUserId(Long userId);
    Long findByUserCount(Long userId);

    boolean editPhoneNumber(String phoneNumber);


    Map<Integer, Users> getParentUsersLevel(Users byUserId);
    List<Long> getParentUsersLevelIds(long parentId);

    List<Long> getFindChildrens(Long parentId);


    List<Long> getFindByMyUsers(long parentId);

    MyPage<Map<String, Object>> findByMiniList(int pageSize, int current, long agentId, long userId);
    MyPage<Map<String, Object>> findParentByMiniList(int pageSize, int current, long parentUserId);


    Users findByUserLogin(LoginConfig loginConfig) throws AuthException;

    MyPage<Map<String, Object>> findByList(int pageSize, int page, String invite, String userName, String nickname, String phone      , String authName
            , long id
            , long agentId, int status);

    Map<String, Object> getCurrentUser();
    List<Map<String, Object>> getBackFindTreeList(long userId);
   Map<String, Object> getFindTreeList(long userId);



    MyPage<Map<String, Object>> findByPageBackAgentList(int pageSize, int page, long agentId, String invite, String name, String parentName, String phone, String wechat);

    Map<String, Object> findById(long id);

    boolean isPhoneValid(String phone);

    Users findByUserPhone(String phone);

    boolean isPhoneAndIdValid(String phone, Long id);

    boolean isUsers(Long parentUserId);

    Map<String, Object> findByUserAuthPhone(String phone);

    Map<String, Object> getUserStastic();

    boolean changeAvatar(Long userId, Long id, String url);

    Map<String, Object> findBySuorceId(Long userId);

    List<Map<String, Object>> findMyParentList(long userId);

    List<Map<String, Object>> findMiniByUserAuthPhone(String phone);

    Users findByLoginOrPhone(String openid, String phone);

    Users findByParentAgentUserId(Long parentId, long agentLevel);
    Users findByParentAgentUserIdLP(Long parentId, long agentLevel);

    boolean byUsersDeleteOpenId(String openid);

    List<Users> findMyUserParentList(long userId);

    Users findByUserIdAndPassword(Long userId, String password);

    List<Map<String, Object>> findMyBrithList();

    List<Users>  findByAdminList();

    Users findByMpOpenId(String openid);

    void unsubscribe(String openId);

    void subscribe(String openId);
}
